let db = require('../db/index')

exports.get = (req, res) => {   //通过user查询用户是否存在
    var sql = 'select * from user where username = ?'    //？用于占位
    db.query(sql, [req.query.username], (err, data) => {
      if(err) {
        return res.send({
          status: 201,
          message: "操作失败"
        })
      }
      if(data.length > 0) {
        return res.send({
          status: 202,
          message: '用户名已存在'
        })
      }else{
        return res.send({
            status: 203,
            message: "用户名不存在"
          })
      }

    })
}
